
 

 

var Helloworld = cc.Layer.extend({
    isMouseDown:false,
    helloImg:null,
    helloLb:null,
    circle:null,
    sprite:null,

    
    //createButton:
    
    
    init:function () {
        var selfPointer = this;
        //////////////////////////////
        // 1. super init first
        this._super();

        var size = cc.Director.getInstance().getWinSize();

        
        // add "HelloWorld" splash screen"
        this.sprite = cc.Sprite.create("res/LightedBackground.png");
        this.sprite.setPosition(cc.p(size.width / 2, size.height / 2));
        this.sprite.setVisible(true);
        this.sprite.setAnchorPoint(cc.p(0.5, 0.5));
        this.addChild(this.sprite, 0);

        // avatar
        var avatar = cc.Sprite.create("res/avatar_body.png");
        avatar.setPosition(cc.p(size.width - 150, size.height / 2 - 150 ));
        avatar.setAnchorPoint(cc.p(0.5, 0));
        this.sprite.addChild(avatar, 0);
        
        // main text
        var helloLabel = cc.LabelTTF.create("Hello World", "Arial", 38);
        helloLabel.setPosition(cc.p(size.width / 2, size.height - 50));
        this.sprite.addChild(helloLabel, 5);
        
        
        this.setTouchEnabled(true);
        
        
        //Menu
        
        var items = new Array();
        var p = cc.p(0,130);
        var offsetY = 47;
        
        items[0] = createButton("Presentation");
        items[0].setPosition( p );
        items[0].setCallback(this,
            function () {
                myApp.GoToScene( new presentationScene() );
            });
        
        p =  cc.p( p.x + 0, p.y - offsetY ); 
        items[1] = createButton("Projects");
        items[1].setPosition( p );
        items[1].setCallback(this,
            function () {
                myApp.GoToScene( new projectsScene() );
            });
            
        p =  cc.p( p.x + 0, p.y - offsetY ); 
        items[2] = createButton("water");
        items[2].setPosition( p );
        items[2].setCallback(this,
            function () {
                myApp.GoToScene( new waterScene() );
            });
            
            
        p =  cc.p( p.x + 0, p.y - offsetY ); 
        items[3] = createButton("piano");
        items[3].setPosition( p );
        items[3].setCallback(this,
            function () {
                myApp.GoToScene( new pianoScene() );
            });
            
            
        p =  cc.p( p.x + 0, p.y - offsetY ); 
        items[4] = createButton("meta");
        items[4].setPosition( p );
        items[4].setCallback(this,
            function () {
                myApp.GoToScene( new metaScene() );
            });
            
            
        p =  cc.p( p.x + 0, p.y - offsetY ); 
        items[5] = createButton("meta water");
        items[5].setPosition( p );
        items[5].setCallback(this,
            function () {
                myApp.GoToScene( new metaWaterScene() );
            });
            
        
        p =  cc.p( p.x + 0, p.y - offsetY ); 
        items[6] = createButton("Rigid Body");
        items[6].setPosition( p );
        items[6].setCallback(this,
            function () {
                myApp.GoToScene( new RigidBodyScene() );
            });
            
        
        p =  cc.p( p.x + 0, p.y - offsetY ); 
        items[7] = createButton("Particles");
        items[7].setPosition( p );
        items[7].setCallback(this,
            function () {
                myApp.GoToScene( new ParticlesScene() );
            });
        
        var myMenu = cc.MenuCustom.create(items);
        this.sprite.addChild(myMenu);
        
        return true;
    },
});


var HelloWorldScene = cc.Scene.extend({
    onEnter:function () {
        this._super();
        var layer = new Helloworld();
        layer.init();
        this.addChild(layer);
    }
});


